﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MediaBrowser.Library.Persistance;
using System.IO;
using System.Globalization;
using MediaBrowser.Library.Extensions;
using MediaBrowser.Library.Configuration;
using MediaBrowser.Library.Localization;
using MediaBrowser.Library.Logging;

//***************************************************************************************************
//  This class is used to extend the string data used by MB.  It is localizable.
//  The most common use will be to provide description strings for config options.  To do this
//  define public string properties that are named the same as the label text of your options on your
//  config panel +desc.  A couple of examples have been generated by the template.
//***************************************************************************************************
namespace SecureContent
{
    [Serializable]
    public class MyStrings : LocalizedStringData
    {
        const string VERSION = "1.0000"; //this is used to see if we have changed and need to re-save

        //these are our strings keyed by property name
        public string SecureContentOptionsDesc = "Options for the SecureContent Plug-in.";
        public string SecureContentTestOptionDesc = "This option is for the SecureContent Plug-in.";

        public MyStrings() //for the serializer
        {
        }

        public static MyStrings FromFile(string file)
        {
            MyStrings s = new MyStrings();
            XmlSettings<MyStrings> settings = XmlSettings<MyStrings>.Bind(s, file);

            Logger.ReportInfo("Using String Data from " + file);

            if (VERSION != s.Version)
            {
                File.Delete(file);
                s = new MyStrings();
                settings = XmlSettings<MyStrings>.Bind(s, file);
            }
            return s;
        }
    }
}
